$(function () {
    var meetNum = GetQueryString("meetNum");
    var type = GetQueryString("type");
    $("#addData").on("click", function () {
        var name = $("#name").val();
        var tel = $("#tel").val();
        var hospitalName = $("#hospitalName").val();
        if (name == "") {
            alert("姓名不能为空！");
            return false;
        }
        if (!(valPhone(tel))) {
            alert("手机格式不正确！");
            return false;
        }
        if (hospitalName == "") {
            alert("医院不能为空！");
            return false;
        }
        var addSel = $.Params.create();
        addSel.addParams("name", name);
        addSel.addParams("tel", tel);
        addSel.addParams("hospitalName", hospitalName);
        addSel.addParams("meetNum", meetNum);
        addSel.addParams("type", type);
        addSel.ajax("post", getAdminIP() + "pfMembers", function (data) {
            if (data.success) {
                if (type == "1") {
                    window.location.href = "pfMemberJudgeList.html?meetNum=" + meetNum + "&type=" + type;
                } else if (type == "2") {
                    window.location.href = "pfMemberPlayerList.html?meetNum=" + meetNum + "&type=" + type;
                }
            } else {
                alert(data.msg);
            }
        })
    })

    $("#cancelAdd").on("click", function () {
        history.go(-1);
    })
})